# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Josip Ponjavic <josipponjavic at gmail dot com>
# Contributor: Xu Fasheng <fasheng.xu[AT]gmail.com>

pkgname=deepin-control-center
pkgver=6.0.31
pkgrel=1
pkgdesc='Control panel of Deepin Desktop Environment'
arch=('loong64' 'x86_64')
url="https://github.com/linuxdeepin/dde-control-center"
license=('GPL3')
depends=('dtkcore' 'dtkgui' 'dtkwidget' 'qt5-base' 'deepin-account-faces' 'deepin-api' 'geoip'
         'libpwquality' 'geoip-database' 'geoip-database-extra' 'deepin-daemon' 'startdde'
         'deepin-qt5integration' 'deepin-pw-check' 'deepin-network-core' 'qt5-multimedia'
         'polkit-qt5' 'deepin-desktop-theme')
makedepends=('cmake' 'deepin-dock' 'gmock' 'gtest' 'ninja' 'qt5-tools' 'deepin-gettext-tools'
             'doxygen')
optdepends=('redshift: automatic color temperature support')
# Not packaged: network-manager-l2tp
conflicts=('dde-control-center' 'dde-dock-applets')
replaces=('dde-control-center' 'dde-dock-applets')
groups=('deepin')
source=("https://github.com/linuxdeepin/dde-control-center/archive/$pkgver/$pkgname-$pkgver.tar.gz"
        $pkgname-systeminfo-deepin-icon.patch)
sha512sums=('87a5122a3f9b7d7a2078d2f3acf23521064eb1a1eb7f44bb7ae3ebe8289b83c874e19aeccae8310b4b213c5c9834411b4f08334191cc68bf0e20c365896bb47c'
            '74fd63391e923ca37f4559f30da967ba7f33d4426b60d58d1ece8cd9a154578e8184b1a376a8d7ff3ef81ffce530915f79d0845a2612ae4e06522b96855ab3dd')

prepare() {
  patch -d dde-control-center-$pkgver -Np1 < $pkgname-systeminfo-deepin-icon.patch
  mkdir -p build
}

build() {
  cd build
  cmake \
    -GNinja \
    -DDISABLE_AUTHENTICATION=YES \
    -DDISABLE_LANGUAGE=YES \
    -DDISABLE_UPDATE=YES \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=/usr/lib \
    ../dde-control-center-$pkgver
  ninja
}

check() {
  cd build
  #ninja test
}

package() {
  cd build
  DESTDIR="$pkgdir" ninja install
}
